﻿using System;
using System.Collections.Generic;
using System.Text;
using System.EnterpriseServices;

namespace _14_COMClient
{
    class Program
    {
        static void Main(string[] args)
        {
            /*
            _13_COMServer.IMyCOMServer srv = new _13_COMServer.MyCOMServerImpl();
            Console.WriteLine(srv.doSomeAction());
            Console.ReadLine();
             /* */
            // Получаем тип ком-объекта из его CLSID...
            Type type = Type.GetTypeFromCLSID(new Guid("F79A8505-D2AA-4504-8794-6D85498FE0B6"), "localhost");
            // Создаем экземпляр...
            _13_COMServer.IMyCOMServer srv = (_13_COMServer.IMyCOMServer)Activator.CreateInstance(type);
            _13_COMServer.MyParameter param = new _13_COMServer.MyParameter();
            param.sParam = "Client";
            Console.WriteLine(srv.doSomeAction(param));
            Console.ReadLine();
            ServicedComponent.DisposeObject((ServicedComponent)srv);
        }
    }
}
